<script setup lang="ts">
import { ref } from 'vue'

const emit = defineEmits(['close'])
const show = ref(false)
defineExpose({
  show,
})

const editRef = ref()
const formModel = ref({
  sb_list: 886782193,
  mbs1: 0,
  mbs2: 0,
  pay_total: 0,
  pays: '304.60',
  sb_onTime: '2025-01-09 07:48:21',
  tb_tota: 0,
  tbs1: 0,
  tbs2: 0,
  zcs1: 0,
  zcs2: 0,
})

function handleSubmit() {
  editRef.value.validate().then(({ valid, errors }) => {
    if (valid) {
      console.log('表单验证通过')
      // 提交表单逻辑
      emit('close', false)
      show.value = false
    }
    else {
      console.log('表单验证不通过')
    }
  })
}
function handleClose() {
//   show.value = false

}
</script>

<template>
  <wd-popup v-model="show" lock-scroll position="bottom" :safe-area-inset-bottom="true" closable custom-style="height: 1000rpx;overflow: hidden;" @close="handleClose">
    <view class="wot-form-title">
      【 设备＞详情 】
    </view>
    <wd-form ref="editRef" :model="formModel">
      <wd-input
        v-model="formModel.sb_list"
        label="设备编号："
        label-width="100px"
        prop="name"
        clearable
        readonly
      />
      <view class="content">
        <view class="settings">
          获取 硬件数据
        </view>
        <wd-input
          v-model="formModel.tbs1"
          label="投币器1："
          label-width="70px"
          prop="name"
          clearable
          readonly
        />
        <wd-input
          v-model="formModel.tbs2"
          label="投币器2："
          label-width="70px"
          prop="name"
          clearable
          readonly
        />
        <wd-input
          v-model="formModel.zcs1"
          label="纸钞机1："
          label-width="70px"
          prop="name"
          clearable
          readonly
        />
        <wd-input
          v-model="formModel.zcs2"
          label="纸钞机2："
          label-width="70px"
          prop="name"
          clearable
          readonly
        />
        <wd-input
          v-model="formModel.mbs1"
          label="码表数1："
          label-width="70px"
          prop="name"
          clearable
          readonly
        />
        <wd-input
          v-model="formModel.mbs2"
          label="码表数2："
          label-width="70px"
          prop="name"
          clearable
          readonly
        />
        <view class="settings">
          清除数据 > 清除记录 (后台统计)
        </view>
        <view class="settings">
          清除数据 > 重新统计 (硬件及后台统计)
        </view>
      </view>
      <wd-input
        v-model="formModel.sb_onTime"
        label="上线时间："
        label-width="70px"
        prop="name"
        clearable
        readonly
      />
    </wd-form>
  </wd-popup>
</template>

<style lang="scss" scoped>
.settings{
    font-size: 28rpx;
    color: #fff;
    font-weight: bold;
    background-color: $uni-color-primary;
    width: 100%;
    line-height: 62rpx;
    text-align: center;
    margin: 0 auto 30rpx;
    border-radius: 6rpx;
}
.content{
    padding: 30rpx 30rpx 0;
    margin: 0 30rpx 20rpx;
    border: 1px solid #ececec;
    border-radius: 6rpx;
}
.wd-form{
    padding: 20rpx 40rpx 0;
}
.wd-input.is-cell{
    padding-top: 0;
}
</style>
